package com.wsc.wsckeeper.activities.base;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;

import com.wsc.wsckeeper.app.KFrontManager;
import com.wsc.wsckeeper.enums.Mode;
import com.wsc.wsckeeper.model.KRuntimeModel;
import com.wsc.wsckeeper.utils.DialogUtils;

public abstract class BaseActivity extends Activity {
	public KFrontManager controller = KFrontManager.getInstance();

	protected Menu menu;
	protected Mode mode;
	protected KRuntimeModel runtime = KRuntimeModel.getInstance();

	private static Handler handler = new Handler();

	protected Handler getHander() {
		return handler;
	}

	public void showExceptionAsDialog(final Exception e) {
		DialogUtils.showException(BaseActivity.this, e);
	}

	public void initComponents() {
	}

	public void initValues() {

	}

	public void initListeners() {

	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		initComponents();
		initValues();
		initListeners();
	}

	@Override
	public void onBackPressed() {
		super.onBackPressed();
	}

	protected boolean isMode(Mode mode) {
		if (this.mode == mode)
			return true;
		else
			return false;
	}
}
